package com.umeox.watch.moto.dataservice.db.dao;


import android.database.Cursor;

import androidx.annotation.NonNull;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.umeox.watch.moto.dataservice.db.model.BuddyInfo;

import java.util.List;

@Dao
public interface BuddyDao {

    @Query("SELECT * FROM BUDDY_INFO WHERE friendId=:friendId")
    BuddyInfo query(String friendId);

    @Query("SELECT * FROM buddy_info")
    List<BuddyInfo> queryAll();

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long save(@NonNull BuddyInfo buddyInfo);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void save(List<BuddyInfo> items);

    @Delete
    int delete(BuddyInfo buddyInfo);

    @Delete
    void delete(List<BuddyInfo> items);

    @Query("DELETE FROM buddy_info")
    int deleteAll();

    @Query("SELECT * FROM buddy_info")
    Cursor query();

}
